package com.yanqu.road.server.cmd.activity.cross;

import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.cross.activity.CrossActivityProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CROSS_ACTIVITY_QUERY_RANK_LIST, desc = "获取跨服指定区服排行榜数据")
public class CrossActivityQueryRankListCmd extends AbstractCommand {

	private int activityId;
	private long serverId;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		CrossActivityProto.CrossActivityQueryRankListReqMsg reqMsg = CrossActivityProto.CrossActivityQueryRankListReqMsg.parseFrom(packet.getBytes());
		activityId = reqMsg.getActivityId();
		serverId = reqMsg.getServerId();
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		CrossActivityProto.CrossActivityQueryRankListReqMsg.Builder msg = CrossActivityProto.CrossActivityQueryRankListReqMsg.newBuilder();
		msg.setActivityId(activityId);
		msg.setServerId(serverId);
		YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.C_CROSS_ACTIVITY_SERVER_QUERY_RANK, msg);
		GamePlayerMgr.sendPacket(player.getUserId(), pbMsg);
	}

	@Override
	public void sendData(GamePlayer player) {

	}
}
